//
//  AmountCell.m
//  sensen_ios
//
//  Created by pro on 16/2/26.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "AmountCell.h"


@interface AmountCell ()

@property (nonatomic, strong) AmountModifyView *amountModifyView; // 数量修改视图

@end

@implementation AmountCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        self.contentView.width = frame.size.width;
        self.contentView.height = frame.size.height;
        [self _initViews];
    }
    
    return self;
}

#pragma mark -- 创建视图 --
- (void)_initViews {
    
    CGFloat x = 10;
    CGFloat y = 0;
    CGFloat width = 100;
    CGFloat height = self.contentView.height;
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
    label.font = FONT(14);
    label.text = @"购买数量";
    label.textColor = [UIColor darkGrayColor];
    label.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:label];
    
    // 数量修改视图
    width = 100;
    height = 30;
    x = self.contentView.width - 20 - width;
    y = (self.contentView.height - height) / 2;
    _amountModifyView = [[AmountModifyView alloc] initWithFrame:CGRectMake(x, y, width, height)];
    [self.contentView addSubview:_amountModifyView];
    _amountModifyView.tag = 100; // 用于去除数量视图获得数量
    
    // 线
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width, 0.5)];
    line.backgroundColor = [UIColor colorWithWhite:0.85 alpha:1];
    line.bottom = self.contentView.bottom;
    [self.contentView addSubview:line];
    
    UIView *line_top = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width, 0.5)];
    line_top.backgroundColor = [UIColor colorWithWhite:0.85 alpha:1];
    line_top.top = self.contentView.top;
    [self.contentView addSubview:line_top];
}


@end
